export const OrderModalMixin = {
  data() {
    return {
      action: '',
      title: '',
      visible: false,
      disableSubmit: false
    };
  },

  methods: {
    add() {
      this.visible = true;
      // 重置disabled状态为false，确保新增时表单可编辑
      this.disabled = false;
      this.$nextTick(() => {
        // 打印确认此时的 action 是否为 "add"
        console.log("模态框 add 方法的 action：", this.action);
        if (this.$refs.realForm) {
          this.$refs.realForm.action = this.action; // 传递给表单
          this.$refs.realForm.disabled = false; // 确保子表单组件也重置为非禁用状态
        }
        this.$refs.realForm.add();
      });
    },
    edit(record) {
      this.visible = true;
      this.$nextTick(() => {
        // 打印确认此时的 action 是否为 "edit"
        console.log("模态框 edit 方法的 action：", this.action);
        if (this.$refs.realForm) {
          this.$refs.realForm.action = this.action; // 传递给表单
          console.log('this.$refs.realForm.action',this.$refs.realForm.action);
          
        }
        this.$refs.realForm.edit(record,this.action);
      });
    },
    close() {
      this.$emit('close');
      this.action = '';
      this.visible = false;
    },
    submitCallback() {
      this.$emit('ok');
      this.visible = false;
    },
    handleOk() {
      this.$refs.realForm.handleOk();
    },
    handleCancel() {
      this.close()
    },
    handleSave() {
      this.$refs.realForm.handleSave();
    },

    handleSubmit() {
      this.$refs.realForm.handleSubmit();
    },
    handleCheck() {
      this.$refs.realForm.handleCheck();
    },
    handleEbpm() {
      this.$refs.realForm.handleEbpm();
    },
    handleExecute() {
      this.$refs.realForm.handleExecute();
    },
    handleClose() {
      this.$refs.realForm.handleClose();
    },
    handleUnclose() {
      this.$refs.realForm.handleUnclose();
    },
    handleVoid() {
      this.$refs.realForm.handleVoid();
    },
    handlePrint() {
      this.$emit('print', this.$refs.realForm.model.id);
    },

  }
}